﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain;
using Service.Interface;
using Dao.Interface;

namespace Service
{
    public class MobilePageService : Service<MobilePage>, IMobilePageService
    {
        /// <summary>
        /// 获取手机页分页集合
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="pageCount">总页数</param>
        /// <returns></returns>
        public IList<MobilePage> LoadAllMobilePageByPage(int userID, int pageIndex, int pageSize, out int pageCount, bool delete)
        {
            return ((IMobilePageRepository)(this.CurrentRepository)).LoadAllMobilePageByPage(userID, pageIndex, pageSize, out pageCount, delete).ToList();
        }

        /// <summary>
        /// 更新手机页是否扔进垃圾箱
        /// </summary>
        /// <param name="mobilepageID">手机页ID</param>
        /// <param name="delete">是否删除</param>
        public void UpdateMobilePageMarkDelete(object mobilepageID, bool delete)
        {
            if (mobilepageID == null)
            {
                return;
            }
            MobilePage mobilepage = ((IMobilePageRepository)(this.CurrentRepository)).Get(mobilepageID);
            mobilepage.MarkDelete = delete;
            ((IMobilePageRepository)(this.CurrentRepository)).Update(mobilepage);
        }

        /// <summary>
        /// 获取手机页集合
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="delete">是否删除</param>
        /// <returns></returns>
        public IList<MobilePage> LoadAllMobilePage(object userID, bool delete)
        {
            if (userID == null)
            {
                return null;
            }
            return ((IMobilePageRepository)(this.CurrentRepository)).LoadAllMobilePage(userID, delete);
        }
    }
}
